package com.mecuros.user.filter;

import com.netflix.loadbalancer.Server;
import com.netflix.loadbalancer.ServerListFilter;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.commons.httpclient.HttpClientConfiguration;
import org.springframework.cloud.netflix.ribbon.apache.HttpClientRibbonConfiguration;
import org.springframework.cloud.netflix.ribbon.okhttp.OkHttpRibbonConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * @Classname TestRibbonConfiguration
 * @Description TODO
 * @Date 2022/1/25 11:34 下午
 * @Created by yujianbo
 */
@Configuration(proxyBeanMethods = false)
@EnableConfigurationProperties
// Order is important here, last should be the default, first should be optional
// see
// https://github.com/spring-cloud/spring-cloud-netflix/issues/2086#issuecomment-316281653
@Import({ HttpClientConfiguration.class, OkHttpRibbonConfiguration.class,
         HttpClientRibbonConfiguration.class })
public class TestRibbonConfiguration {

    @Bean
    public ServerListFilter<Server> ribbonServerListFilter(){
        GrayFilter x= new GrayFilter();
        return x;
    }
}
